%%
%% This is file `qyxf-book.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% qyxf-book.dtx  (with options: `class')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2019 by xjtu-blacksmith
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in:
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% -----------------------------------
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{qyxf-book}
  [2019/04/28 v1.0 nothing but a skeleton]
\typeout{The book template provided by Qian Yuan Xue Fu}
\LoadClass[10pt,twoside,openany]{book}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=QYXF,prefix=QYXF@,setkeys=\kvsetkeys}
\DeclareBoolOption[false]{parskip}
\DeclareBoolOption[false]{smallersize}
\DeclareVoidOption{b5paper}{\kvsetkeys{QYXF}{smallersize}}
\DeclareBoolOption{color}
\DeclareBoolOption[true]{decoration}
\DeclareBoolOption[false]{opensource}
\ProcessKeyvalOptions*
\RequirePackage[heading]{ctex}
\setmainfont{Cambria}       % 目前默认使用的serif字体
\setsansfont{Calibri}       % 目前默认使用的sans-serif字体
\setmonofont{Courier New}   % 目前默认使用的等宽字体
\RequirePackage{amsmath}
\RequirePackage{unicode-math}
\setmathfont{Cambria Math}  % 与正文字体相适应的数学字体
\renewcommand{\thefootnote}{\textbf{(\arabic{footnote})}}
\RequirePackage{graphicx}
\graphicspath{{./figure/}{./pic/}{./image}}
\setlength{\textfloatsep}{6pt plus 2pt minus 4pt}
\setlength{\intextsep}{6pt plus 2pt minus 2pt}
\RequirePackage{longtable,booktabs}
\RequirePackage{tikz}
\usetikzlibrary{calc,backgrounds}
\RequirePackage{tcolorbox,tabu}
\tcbuselibrary{listings,theorems,skins}
\newcounter{exercises}[chapter]
\setcounter{exercises}{1} %初始化为1
\newcommand{\exercise}{\stepcounter{exercises}\noindent\tcbox[on line,top=0mm,bottom=0mm,right=0mm,left=0mm]{\bfseries 练习 \arabic{exercises}}\ }
\newcommand{\note}{\noindent\textbf{注记}\ }
\newcommand{\solve}{\noindent\textbf{解}\hspace{1em}}
\newcommand{\analysis}{\noindent\textbf{分析}\ }
%公式按照题目标号，不知道为啥编译不了，只能手动添加到各章
%\makeatletter
%\@addtoreset{equation}{exercise}
%\makeatother
\renewcommand{\theequation}{(\arabic{chapter}.\arabic{equation})}
% 这里可以自定义一些命令
\newcommand{\di}[1]{\mathrm{d}#1}
\newcommand{\p}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pp}[2]{\frac{\partial ^2 #1}{\partial #2 ^2}}
\newcommand{\dy}[2]{\frac{\di{#1}}{\di{#2}}}
\newcommand{\ddy}[2]{\frac{\mathrm{d} ^2 #1}{\mathrm{d} #2 ^2}}
\newcommand{\zbj}[4]
{
	\draw (0,0) node[below left] {$ O $};
	\draw [->] (#1,0) -- (#2,0) node[right] {$ x $};
	\draw [->] (0,#3) -- (0,#4) node[right] {$ y $};
}

\RequirePackage{geometry}
\ifQYXF@smallersize
  \setlength{\paperwidth}{176mm}
  \setlength{\paperheight}{250mm}
\else
  \geometry{a4paper}
\fi
\geometry{margin=1in}
\RequirePackage{hyperref}
\hypersetup{
    breaklinks,
    unicode,
    linktoc=all,
    bookmarksnumbered=true,
    bookmarksopen=true,
    pdfkeywords={qyxf-book},
    pdfborder={0 0 0},
    linktocpage,
    pageanchor=true
}
\RequirePackage{pgfornament-han}
\ctexset{section={name={\S,}}}
\RequirePackage{titlesec,titletoc}
\titlecontents{chapter}[24pt]{\hspace{-2pc}\filright}
              {\normalsize\bfseries\contentspush{\thecontentslabel\ }}
              {}{\bfseries\titlerule*[8pt]{.}\contentspage}
\titlecontents{section}[20pt]{\filright}
              {\contentspush{\thecontentslabel\ }}
              {}{\titlerule*[8pt]{.}\contentspage}
\titlecontents{subsection}[18pt]{\hspace{2pc}\filright}
              {\contentspush{\thecontentslabel\ }\itshape}
              {}{\titlerule*[8pt]{}\contentspage}
\setcounter{tocdepth}{2}
\RequirePackage{fancyhdr}
\fancyhead[EC]{\fangsong\nouppercase\leftmark}
\fancyhead[OC]{\fangsong\nouppercase\rightmark}
\fancyhead[EL,OR]{\bf\thepage}
\fancyhead[ER,OL]{}
\fancyfoot[C]{\textsc{Qian Yuan Xue Fu}\\\resizebox{0.2\linewidth}{1.5ex}{%
\pgfornamenthan[scale=0.05]{58}}}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\textsc{Qian Yuan Xue Fu}\\\resizebox{0.2\linewidth}{1.5ex}{%
\pgfornamenthan[scale=0.05]{58}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\setlength{\headheight}{13pt}
\RequirePackage{lastpage}
\RequirePackage{enumerate}
\RequirePackage{pifont}
\RequirePackage{appendix}
\ctexset{appendix={number={\Roman{chapter}}}}
\RequirePackage[scale=1.1]{ccicons}
\ifQYXF@parskip
     \setlength\parskip{0.3\baselineskip}
\fi
\newtoks\subtitle
\newtoks\typo
\newtoks\version
\newtoks\sourcepage
\renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false}
\begin{titlepage}
\phantom{s}
\vspace{3cm}
\begin{center}\large
\begin{tcolorbox}[blanker,borderline west={1mm}{0pt}{black!80},%
left=20pt]
{\fontsize{40pt}{\baselineskip}\selectfont\bfseries\@title}\\[\baselineskip]
{\huge\itshape\the\subtitle}
\end{tcolorbox}
\begin{tcolorbox}[blanker,borderline west={1mm}{0pt}{black!50},%
left=20pt]
{\Large 作者：\@author\\[0.3\baselineskip]
\@date}
\end{tcolorbox}
\vfill
\texttt{钱学森书院学业辅导中心}\\[0.5\baselineskip]
\textsc{Qian Yuan Xue Fu}\\[0.5\baselineskip]
{XI'AN JIAOTONG UNIVERSITY}
\end{center}
\begin{tikzpicture}[remember picture,overlay]
  \begin{pgfonlayer}{background}
  \node at ($(current page.east) +(0in,0in)$) {%
  \includegraphics[width=0.8\textwidth]{./template/cover.png}};
  \end{pgfonlayer}
\end{tikzpicture}
\end{titlepage}
\thispagestyle{empty}
\newpage
\hypersetup{pageanchor=true}
\phantom{s}\vfill
\begin{tcolorbox}[title={\bfseries 作品信息}]
\ding{228} \textbf{标题：}\@title{} - \textit{\the\subtitle}\\
\ding{228} \textbf{作者：}\@author\\
\ding{228} \textbf{校对排版：}\the\typo\\
\ding{228} \textbf{出品时间：}\@date\\
\ding{228} \textbf{总页数：}\pageref{LastPage}
\end{tcolorbox}
\begin{tcolorbox}[title={\bfseries 编写组成员}]
	\ding{228} \textbf{第十一次：}越杰81 苏预达\\
	\ding{228} \textbf{第十二次：}越杰81 郭秉瑞\\
	\ding{228} \textbf{第十三次：}电气钱82 蒋施达\\
	\ding{228} \textbf{第十四次：}电气钱81 赵恒欣\\
	\ding{228} \textbf{第十五次：}电气钱82 李明轩\\
	\ding{228} \textbf{第十六次：}微电子钱81 彭帅\\
	\ding{228} \textbf{第十七次：}电气钱81 赵恒欣\\
	\ding{228} \textbf{第十八次：}越杰81 周明烁\\
	\ding{228} \textbf{排版：}电气钱81 白玉琛，化生81 高旭帆\\
	\ding{228} \textbf{总负责人：}化生81 高旭帆
\end{tcolorbox}
\begin{tcolorbox}[title={\bfseries 许可证说明}]
\centerline{\tcbox{\ccbyncnd\ \fangsong 知识共享 (Creative Commons) BY-NC-ND 4.0 协议}%
\\[0.3\baselineskip]}
本作品采用 \href{https://creativecommons.org/licenses/by-nc-nd/4.0/}{\textbf{CC协议}}
进行许可。使用者可以在给出\emph{作者署名及资料来源}的前提下对本作品进行\emph{转载}，但不得对
本作品进行\emph{修改}，亦不得基于本作品进行\emph{二次创作}，不得将本作品运用于\emph{商业用途}。
\end{tcolorbox}
\newcommand{\opensourceinfo}{根据作者的要求，本作品未公开源码。}
\ifQYXF@opensource
  \begin{tcolorbox}
  本作品已发布于GitHub之上，发布地址为：\\
  \centerline{\the\sourcepage}
  本作品的版本号为\textsf{\the\version}。
  \end{tcolorbox}
\fi
\newpage
}
\renewcommand\tableofcontents{%
\pagestyle{empty}
\centerline{%
\normalfont\Huge\bfseries\contentsname%
\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
\small\normalfont 注：电子版点击页码跳转
}
\normalsize
\vskip 3ex%
{\setlength\parskip{0pt}\@starttoc{toc}}
\cleardoublepage
\pagestyle{fancy}
%\RequirePackage{indentfirst}
\setlength{\parindent}{2em}
\setcounter{page}{1}
}
\endinput
%%
%% End of file `qyxf-book.cls'.